//
//  CollectionBaseCell.swift
//  DouYuZB
//
//  Created by James on 2017/10/17.
//  Copyright © 2017年 James. All rights reserved.
//

import UIKit

class CollectionBaseCell: UICollectionViewCell {
    @IBOutlet weak var iconImageView: UIImageView!
    
    @IBOutlet weak var onlionBtn: UIButton!
    
    @IBOutlet weak var nickNameLabel: UILabel!
    
    // MARK: - 定义模型属性
    var anchor:AnchorModel?{
        didSet{
            guard let anchor = anchor else { return }
            var onlineStr:String = ""
            if anchor.online >= 1000 {
                onlineStr = "\(anchor.online/1000)万在线"
            }else{
                onlineStr = "\(anchor.online)在线"
            }
            //在线人数
            onlionBtn.setTitle(onlineStr, for: .normal)
            //昵称
            nickNameLabel.text = anchor.nickname
            
            //封面
            iconImageView.sd_setImage(with: URL(string:anchor.vertical_src), completed: nil)
        }
    }
}
